/*
 * Copyright (c) 2017 MediaTek Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

/ {
	mt6360_pmu: mt6360_pmu_dts {
		status = "ok";
		mt6360,intr_gpio_num = <3>; /* direct defined GPIO num */
		mt6360,intr_gpio = <&pio 3 0x0>; /* GPIO */
		interrupt-controller;
		#interrupt-cells = <2>;
		adc: adc {
			compatible = "mediatek,mt6360_pmu_adc";
			interrupt-parent = <&mt6360_pmu>;
			interrupts = <41 0>, <43 0>, <44 0>;
			interrupt-names = "bat_ovp_adc_evt",
					  "adc_wakeup_evt",
					  "adc_donei";
			#io-channel-cells = <1>;
		};
		chg {
			compatible = "mediatek,mt6360_pmu_chg";
			interrupt-parent = <&mt6360_pmu>;
			interrupts = <4 0>, <6 0>, <7 0>, <9 0>,
				     <12 0>, <13 0>, <14 0>, <15 0>,
				     <27 0>, <29 0>, <30 0>, <32 0>,
				     <35 0>, <40 0>, <48 0>, <60 0>;
			interrupt-names = "chg_treg_evt", "chg_mivr_evt",
					  "pwr_rdy_evt", "chg_batsysuv_evt",
					  "chg_vsysuv_evt", "chg_vsysov_evt",
					  "chg_vbatov_evt", "chg_vbusov_evt",
					  "chg_tmri", "chg_adpbadi",
					  "chg_rvpi",  "chg_aiccmeasl",
					  "wdtmri", "pumpx_donei",
					  "attachi", "chrdet_ext_evt";
			io-channels = <&adc 0>, <&adc 1>, <&adc 3>, <&adc 4>,
				      <&adc 5>, <&adc 6>, <&adc 8>, <&adc 10>;
			io-channel-names = "USBID", "VBUSDIV5", "VSYS", "VBAT",
					   "IBUS", "IBAT", "TEMP_JC", "TS";
			chg_name = "primary_chg";
			ichg = <2000000>;		/* uA */
			aicr = <500000>;		/* uA */
			mivr = <4400000>;		/* uV */
			cv = <4350000>;			/* uA */
			ieoc = <150000>;		/* uA */
			safety_timer = <12>;		/* hour */
			ircmp_resistor = <25000>;	/* uohm */
			ircmp_vclamp = <32000>;		/* uV */
			en_te = <1>;
			en_wdt = <1>;
			aicc_once = <1>;
			post_aicc = <1>;
		};
		fled {
			compatible = "mediatek,mt6360_pmu_fled";
			interrupt-parent = <&mt6360_pmu>;
			interrupts = <11 0>, <74 0>, <75 0>, <78 0>,
				     <79 0>;
			interrupt-names = "fled_chg_vinovp_evt", "fled_tx_evt",
					  "fled_lvf_evt", "fled2_short_evt",
					  "fled1_short_evt";
			/* 0: fixed mode, 1: tracking mode */
			fled_vmid_track = <0>;
			/* 64~2432ms, 32ms/step */
			fled_strb_tout = <1248>;
			/* 25000~400000uA, 12500uA/step */
			fled1_tor_cur = <37500>;
			/*
			 * 25000~750000uA, 6250uA/step
			 * 750000~1500000uA, 12500uA/step
			 */
			/*fled1_strb_cur = <800000>; */
			fled1_strb_cur = <750000>;
			/* 25000~400000uA, 12500uA/step */
			fled2_tor_cur = <37500>;
			/*
			 * 25000~750000uA, 6250uA/step
			 * 750000~1500000uA, 12500uA/step
			 */
			fled2_strb_cur = <800000>;
		};
		rgbled {
			compatible = "mediatek,mt6360_pmu_rgbled";
			mt,led_name = "mt6360_pmu_led1", "mt6360_pmu_led2",
				      "mt6360_pmu_led3", "mt6360_pmu_led4";
			mt,led_default_trigger = "cc_mode", "cc_mode",
						 "cc_mode", "none";
		};
		core {
			compatible = "mediatek,mt6360_pmu_core";
			interrupt-parent = <&mt6360_pmu>;
			interrupts = <65 0>, <66 0>, <67 0>,
				     <68 0>, <69 0>, <70 0>,
				     <71 0>;
			interrupt-names = "ap_wdtrst_evt",
					  "en_evt",
					  "qonb_rst_evt",
					  "mrstb_evt",
					  "otp_evt",
					  "vddaov_evt",
					  "sysuv_evt";
			mren = <1>;
			apwdtrst_en = <1>;
			cc_open_sel = <3>;
			i2c_cc_open_tsel = <1>;
			ldo5_otp_en = <0>;
		};
	};

	mt6360_pmic: mt6360_pmic_dts {
		status = "ok";
		interrupt-parent = <&mt6360_pmu>;
		interrupts = <96 0>, <100 0>, <101 0>, <102 0>,
			     <104 0>, <108 0>, <109 0>, <110 0>,
			     <118 0>, <119 0>, <126 0>, <127 0>;
		interrupt-names = "buck1_pgb_evt", "buck1_oc_evt",
				  "buck1_ov_evt", "buck1_uv_evt",
				  "buck2_pgb_evt", "buck2_oc_evt",
				  "buck2_ov_evt", "buck2_uv_evt",
				  "ldo6_oc_evt", "ldo7_oc_evt",
				  "ldo6_pgb_evt", "ldo7_pgb_evt";
		pwr_off_seq = [06 04 00 02];
		buck1 {
			regulator-compatible = "BUCK1";
			regulator-name = "VMDLA";
			regulator-min-microvolt = <300000>;
			regulator-max-microvolt = <1300000>;
			regulator-always-on;
		};
		buck2 {
			regulator-compatible = "BUCK2";
			regulator-name = "VDRAM1";
			regulator-min-microvolt = <300000>;
			regulator-max-microvolt = <1300000>;
			regulator-always-on;
		};
		ldo6 {
			regulator-compatible = "LDO6";
			regulator-name = "VMDDR";
			regulator-min-microvolt = <500000>;
			regulator-max-microvolt = <2100000>;
			regulator-always-on;
		};
		ldo7 {
			regulator-compatible = "LDO7";
			regulator-name = "VDRAM2";
			regulator-min-microvolt = <500000>;
			regulator-max-microvolt = <2100000>;
			regulator-always-on;
		};
	};

	mt6360_ldo: mt6360_ldo_dts {
		status = "ok";
		interrupt-parent = <&mt6360_pmu>;
		interrupts = <113 0>, <114 0>, <115 0>, <117 0>,
			     <121 0>, <122 0>, <123 0>, <125 0>;
		interrupt-names = "ldo1_oc_evt", "ldo2_oc_evt",
				  "ldo3_oc_evt", "ldo5_oc_evt",
				  "ldo1_pgb_evt", "ldo2_pgb_evt",
				  "ldo3_pgb_evt", "ldo5_pgb_evt";
		mt_pmic_vfp_ldo_reg: ldo1 {
			regulator-compatible = "LDO1";
			regulator-name = "VFP";
			regulator-min-microvolt = <1200000>;
			regulator-max-microvolt = <3600000>;
		};
		mt_pmic_vtp_ldo_reg: ldo2 {
			regulator-compatible = "LDO2";
			regulator-name = "VTP";
			regulator-min-microvolt = <1200000>;
			regulator-max-microvolt = <3600000>;
		};
		mt_pmic_vmc_ldo_reg: ldo3 {
			regulator-compatible = "LDO3";
			regulator-name = "VMC";
			regulator-min-microvolt = <1200000>;
			regulator-max-microvolt = <3600000>;
		};
		mt_pmic_vmch_ldo_reg: ldo5 {
			regulator-compatible = "LDO5";
			regulator-name = "VMCH";
			regulator-min-microvolt = <2700000>;
			regulator-max-microvolt = <3600000>;
		};
	};
};

